<script type="text/javascript">
$(function(){
	var pg = App.deploy.packgeRecord.ui, pp = pg.params, 
		pb = pg.children('.body'), bd = pb.children('.body'),
		gd = bd.children('.grid'), ft = pb.children('.foot');
	
	var frm = {
		cancel: ft.seek('cancel')
	};
	
	gd.mac('grid',{
		cols:[{
			field: 'compileType', title : '打包类型', width: 70,
			render: function(r){
				if(r.compileType=='0'){
					return $('<span class="a center">完整包</span>')
				}else if(r.compileType=='1'){
					return $('<span class="a center">程序包</span>')
				}else if(r.compileType=='2'){
					return $('<span class="a center">配置包</span>')
				}
			} 
		},{
			field: 'resultType', title : '打包种类', width: 70,
			render: function(r){
				if(r.resultType=='0'){
					return $('<span class="a center">zip包</span>')
				}else if(r.resultType=='1'){
					return $('<span class="a center">jar包</span>')
				}else if(r.resultType=='2'){
					return $('<span class="a center">war包</span>')
				}
			} 
		},{
			field: 'targetCode', title : '打包应用', width: 160,
		},{
			field: 'status', title : '打包状态', width: 80,
			render: function(r){
				var logUrl = '/logs/' + r.startTime.substring(0, 10) + '/pack/';
				if (r.parentId) {
					logUrl = logUrl + r.parentId + '.htm';
				} else {
					logUrl = logUrl + r.id + '.htm';
				}
				if(r.status=='0'){
					return $('<span class="a center"><a target="_blank" href="'+logUrl+'">成功</a></span>')
				}else if(r.status=='1'){
					return $('<span class="a center"><a target="_blank" href="'+logUrl+'">失败继续</a></span>')
				}else if(r.status=='2'){
					return $('<span class="a center"><a target="_blank" href="'+logUrl+'">失败终止</a></span>')
				}
			}
		},{
			field: 'env', title : '打包环境', width: 80
		},{
			field: 'version', title : '版本号', width: 140
		},{
			field: 'startTime', title : '打包开始时间', width: 180
		},{
			field: 'endTime', title : '打包结束时间', width: 180
		}] ,
		loader: {
			url: App.deploy.ctx + '/record/pack/list.do',
			params: { 
				pageNo: 1, 
				pageSize: 10, 
				planId: 
				pp.planId, 
				targetId: 
				pp.targetId, 
				env: pp.env, 
				orderBy: 'startTime desc' 
			},
			autoLoad: true
		},
		pagerLength: 10
	});
	 frm.cancel.click(function() {
			pg.close();
	});
	
})
</script>
<div class="body">
	<div class="grid"></div>
</div>
<div class="foot" style="text-align: center">
	<button name="cancel" class="addBtn">关闭</button>
</div>